package cn.itcast;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class ArrayList3 {
    public static void main(String[] args) {
        List<Integer> list = new ArrayList<>(List.of(1, 2, 4, 45, 0, 20, 11));
        System.out.println(list);

        //洗牌
        Collections.shuffle(list);
        System.out.println(list);

        //排升序
        Collections.sort(list);
        System.out.println(list);
        Collections.sort(list,(a,b)->a-b);
        System.out.println(list);

        //排降序
        Collections.sort(list,(a,b)->b-a);
        System.out.println(list);

    }

}
